Ext.define('Tg.tx.CURDList',{
	extend: 'Ext.panel.Panel',
    alias : 'widget.CURDList',
	layout: 'fit',
	_TbarLBefore:[],
	_TbarL:[],
	_TbarLAfter:[],
	_TbarRBefore:[],
	_TbarR:[],
	_TbarRAfter:[],
	_Grid:{},
	_Columns:[],
    initComponent: function () {
        var _Me = this;
        var _VM = _Me.getViewModel();
		var _Auth = _VM.get('_Auth');
		var _Tbar = [];
		_Tbar = ArrPush(_Tbar,_Me._TbarLBefore);
		if(JSON.stringify(_Me._TbarL) === '[]' || JSON.stringify(_Me._TbarL) === '{}'){
			if (_Auth.index) {
				_Tbar.push({text: '刷新',itemId:'_Reload',iconCls: 'tf tf-reload',bind:{hidden:'{!_Auth.index}'},handler: "_Reload"});
				if (_Auth.serch !== false) {
					_Tbar.push({text: '搜索',itemId:'_Serch',iconCls: 'tf tf-serch',bind:{hidden:'{!_Auth.index}'},handler: "_Serch"});
				}
			}
			if (_Auth.add) {
				_Tbar.push({text: '新增',itemId:'_Add',iconCls: 'tf tf-add',bind:{hidden:'{!_Auth.add}'},handler: "_Add"});
			}
			if (_Auth.edit) {
				_Tbar.push({text: '更新',itemId:'_Edit',iconCls: 'tf tf-edit',bind:{hidden:'{!_Auth.edit}'},handler: "_Edit",disabled:true});
			}
			if (_Auth.look) {
				_Tbar.push({text: '查看',itemId:'_Look',iconCls: 'tf tf-look',bind:{hidden:'{!_Auth.look}'},handler: "_Look",disabled:true});
			}
			if (_Auth.del) {
				_Tbar.push({text: '删除',itemId:'_Del',iconCls: 'tf tf-del',bind:{hidden:'{!_Auth.del}'},handler: "_Del",disabled:true});
			}
			if (_Auth.put) {
				_Tbar.push({text: '打印',itemId:'_Put',iconCls: 'tf tf-put',bind:{hidden:'{!_Auth.put}'},handler: "_Put",disabled:true});
			}
			if (_Auth.import) {
				_Tbar.push({text: '导入',itemId:'_Import',iconCls: 'tf tf-import',bind:{hidden:'{!_Auth.import}'},handler: "_Import"});
			}
			if (_Auth.export) {
				_Tbar.push({text: '导出',itemId:'_Export',iconCls: 'tf tf-export',bind:{hidden:'{!_Auth.export}'},handler: "_Export"});
			}
		}else{
			_Tbar = ArrPush(_Tbar,_Me._TbarL);
		}
		_Tbar = ArrPush(_Tbar,_Me._TbarLAfter);
		if(_Me._TbarRBefore.length>0 || _Me._TbarR.length>0 || _Me._TbarRAfter.length>0){
			_Tbar.push('->');
			_Tbar = ArrPush(_Tbar,_Me._TbarRBefore);
			_Tbar = ArrPush(_Tbar,_Me._TbarR);
			_Tbar = ArrPush(_Tbar,_Me._TbarRAfter);
		}
		
        _Me.dockedItems = [
			{
				xtype: 'toolbar',
				dock: 'top',
				defaults:{xtype: 'button'},
				items: _Tbar,
			}
		];
        _Me.callParent(arguments);
	},
});